// Copyright (C) <2018> Zealcomm Inc.
//
// SPDX-License-Identifier: Apache-2.0
#ifndef IRTC_BASE_OBJC_IRTCFRAMEGENERATORPROTOCOL_H_
#define IRTC_BASE_OBJC_IRTCFRAMEGENERATORPROTOCOL_H_

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <IRTC/IRTCMacros.h>
NS_ASSUME_NONNULL_BEGIN
/**
 @brief frame generator interface for audio.<br>音频的帧发生器界面。
 @details Sample rate and channel numbers cannot be changed once the generator is
 created. Currently, only 16 bit little-endian PCM is supported.<br>一旦发生器创建出来后，采样率和音频数量就不能改变。目前只支持16位little-endian的PCM。
*/
IRTC_OBJC_EXPORT
@protocol RTCAudioFrameGeneratorProtocol<NSObject>
/**
 @brief Generate frames for next 10ms.<br>生成下10ms的音频帧。
 @param buffer Points to the start address for frame data. The memory is
 allocated and owned by SDK. Implementations should fill frame data to the
 memory starts from |buffer|.<br>帧数据的开始地址指针。这个内存由SDK生成并控制。具体实现时从|buffer|作为起始地址将帧数据填充进去。
 @param capacity Buffer's capacity. It will be equal or greater to expected
 frame buffer size.<br>缓存容量。它等于或大于预期帧大小。
 @return The size of actually frame buffer size.<br>返回实际的帧缓存大小。
 */
- (NSUInteger)framesForNext10Ms:(uint8_t*)buffer capacity:(const NSUInteger)capacity;
/// Get sample rate for frames generated.<br>获取音频帧发生器的采样率。
- (NSUInteger)sampleRate;
/// Get numbers of channel for frames generated.<br>获取音频帧发生器的音频数量。
- (NSUInteger)channelNumber;
@end
/**
 @brief Protocol for video frame generators<br>视频帧生成器的协议。
 RTCLocalCustomizedStream pulls video frames from an object implements this
 protocol. Height, width and frame rate cannot be changed once generator is
 created.<br>RTCLocalCustomizedStream通过一个实现这个协议的对象来获取视频帧。一旦视频帧生成器创建出来了，高、宽和帧率都不能再变。
 */
IRTC_OBJC_EXPORT
@protocol RTCVideoFrameGeneratorProtocol<NSObject>
/**
 @brief Generate next video frame<br>生成下一个视频帧。
 @param buffer Points to the start address for frame data. The memory is
 allocated and owned by SDK. Implementations should fill frame data to the
 memory starts from |buffer|.<br>帧数据的开始地址指针。这个内存由SDK生成并控制。具体实现时从|buffer|作为起始地址将帧数据填充进去。
 @param capacity Buffer's capacity. It will be equal or greater to expected
 frame buffer size.<br>缓存容量。它等于或大于预期帧大小。
 @return The size of actually frame buffer size.<br>返回实际的帧缓存大小。
*/
- (NSUInteger)nextFrame:(uint8_t*)buffer capacity:(const NSUInteger)capacity;
/**
 @brief frame resolution<br>分辨率。
*/
- (CGSize)resolution;
/**
 @brief frame rate, unit: fps<br>帧率（fps）。
*/
- (NSUInteger)frameRate;
@end
NS_ASSUME_NONNULL_END
#endif // IRTC_BASE_OBJC_IRTCFRAMEGENERATORPROTOCOL_H_